
import React, { useContext, useMemo, useRef, useState } from "react";
import AdjustGrid from "./AdjustGrid";
import AdjustToolBar from "./AdjustToolBar";
import { Spin } from "antd";

// 创建一个 Context 对象
const ToolBarDataContext = React.createContext({});

const AdjustContextData = (props: { whereFrom: string }) => {
  const { whereFrom } = props;
  const [toolBarData, setToolBarData] = useState({
    TZQJ: '1', isTZ: "0",
    Data_ID: "",
    showYearName: "",
    TZQJName: "",
    timesData: "",
  });
  return (<div style={{ width: "100%", height: "calc(100vh - 45px)", overflow: "hidden" }}>
    <ToolBarDataContext.Provider value={{ toolBarData, setToolBarData }}>
      {/* <UserChanger /> */}
      <div style={{ width: "100%", height: "36px" }}>
        <AdjustToolBar whereFrom={whereFrom} />
      </div>
      <div style={{ width: "100%", height: "calc(100% - 55px)", marginTop: "10px" }}>
        <AdjustGrid whereFrom={whereFrom} />
      </div>
    </ToolBarDataContext.Provider>
  </div>
  )
}

export default AdjustContextData;

export { ToolBarDataContext }; // 必须这样写 重要！